<?php
class lib_sys_cate extends lib_base{
	public $table_name = "qc_sys_cate";
    public $pk = "id";

    public function getList($cond)
    {
        $all = $this->findAll(array($cond),'sort asc,id asc');
        $all = formatChildData($all);
        return $all;
    }

    public function get_treeList($cond,$sort='sort asc,id desc')
    {
        $all = $this->findAll(array($cond),$sort);
        $all = formatTreeData($all);
        return $all;
    }

    public function get_cates($pid=1){
        $result = $this->findAll(array("status=1 and parent_id={$pid}"),'sort asc');
		if($result){
            foreach($result as $val){
                $res[] = $val['name'];
            }
            return $res;
        }
        return false;
		
    }

}